const widgets = this.getApiPage().getApiWidgetByAliasName('三维组件');
const videoPageWidgets = this.getApiPage().getApiWidgetByAliasName('视频分页组件');
// 获取变量
var stream_url = this.getApiPage().getVariables().find(x => x.name == "stream_url").value;
widgets.widgetObj.sullivan.closeAll(true)

videoPageWidgets.widgetObj.setLimit($event)
if (Array.isArray(window.videoCurrentSelectArea)) {
    // 获取视频组件的分屏数并保存到window上
    window.videoCurrentGridSize = $event
    // 设备当前分页数默认为1并保存到window上
    window.videoCurrentPagenum = 1

    // 根据当前分页和分屏获取当前要展示的视频
    const start = (window.videoCurrentPagenum - 1) * window.videoCurrentGridSize;
    const end = start + window.videoCurrentGridSize;
    const currentVideos = window.videoCurrentSelectArea.slice(start, end)
    currentVideos.map((v, i) => {
        console.log(v)
        if (v.host) {
            return widgets.widgetObj.sullivan.addPlayerWidthData(`${stream_url}/api/v1/stream/rtc/play`, { stream_path: v.stream_path, equipmentCode: v.equipmentCode, ...v }, i)
        } else {
            return window.layer?.msg('摄像头未找到配置！');
        }
    })
}


